flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_lib: bool,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to build benchmarks for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to compile
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
pub struct Flags {
flag_list: bool,
flag_version: bool,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_explain: Option<String>,
-V, --version Print version info and exit
--list List installed commands
--explain CODE Run `rustc --explain CODE`
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_package: Vec<String>,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
--manifest-path PATH Path to the manifest to the package to clean
--target TRIPLE Target triple to clean output for (default all)
--release Whether or not to clean release artifacts
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_no_deps: bool,
flag_open: bool,
flag_release: bool,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_package: Vec<String>,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to document
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Options {
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to fetch dependencies for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Options {
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to generate a lockfile for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
pub struct Options {
flag_url: String,
flag_reference: String,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Options:
-h, --help Print this message
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
#[derive(RustcDecodable)]
pub struct Options {
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_bin: bool,
control at all (none) overriding a global configuration.
--bin Use a binary instead of a library template
--name NAME Set the resulting package name
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
flag_debug: bool,
flag_bin: Vec<String>,
flag_example: Vec<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_root: Option<String>,
--bin NAME Only install the binary NAME
--example EXAMPLE Install the example EXAMPLE instead of binaries
--root DIR Directory to install packages into
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet Less output printed to stdout
--color WHEN Coloring: auto, always, never
pub struct Options {
flag_host: Option<String>,
arg_token: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Options:
-h, --help Print this message
--host HOST Host to set the token for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_no_default_features: bool,
flag_no_deps: bool,
flag_quiet: Option<bool>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
}
pub const USAGE: &'static str = "
--manifest-path PATH Path to the manifest
--format-version VERSION Format version [default: 1]
Valid values: 1
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
#[derive(RustcDecodable)]
pub struct Options {
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_bin: bool,
control at all (none) overriding a global configuration.
--bin Use a binary instead of a library template
--name NAME Set the resulting package name
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
flag_add: Option<Vec<String>>,
flag_remove: Option<Vec<String>>,
flag_index: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_list: bool,
-l, --list List owners of a crate
--index INDEX Registry index to modify owners for
--token TOKEN API token to use when authenticating
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Options {
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_manifest_path: Option<String>,
--no-metadata Ignore warnings about a lack of human-usable metadata
--allow-dirty Allow dirty working directories to be packaged
--manifest-path PATH Path to the manifest to compile
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Options {
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_manifest_path: Option<String>,
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to the package to clean
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_host: Option<String>,
flag_token: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_no_verify: bool,
--no-verify Don't verify package tarball before publish
--allow-dirty Allow publishing with a dirty source directory
--manifest-path PATH Path to the manifest of the package to publish
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to execute
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
--no-default-features Do not compile default features for the package
--target TRIPLE Target triple which compiles will be for
--manifest-path PATH Path to the manifest to fetch dependencies for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
flag_manifest_path: Option<String>,
flag_no_default_features: bool,
flag_open: bool,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_release: bool,
flag_quiet: Option<bool>,
flag_color: Option<String>,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to document
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Options {
flag_host: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_limit: Option<u32>,
Options:
-h, --help Print this message
--host HOST Host of a registry to search in
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
--limit LIMIT Limit the number of results (default: 10, max: 100)
flag_example: Vec<String>,
flag_test: Vec<String>,
flag_bench: Vec<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to build tests for
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
--no-fail-fast Run all tests regardless of failure
pub struct Options {
flag_bin: Vec<String>,
flag_root: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
-h, --help Print this message
--root DIR Directory to uninstall packages from
--bin NAME Only uninstall the binary NAME
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet Less output printed to stdout
--color WHEN Coloring: auto, always, never
flag_aggressive: bool,
flag_precise: Option<String>,
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
--aggressive Force updating all dependencies of <name> as well
--precise PRECISE Update a single dependency to exactly PRECISE
--manifest-path PATH Path to the crate's manifest
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
#[derive(RustcDecodable)]
pub struct Flags {
flag_manifest_path: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to verify
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
flag_token: Option<String>,
flag_vers: Option<String>,
flag_index: Option<String>,
- flag_verbose: Option<bool>,
+ flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_undo: bool,
--undo Undo a yank, putting a version back into the index
--index INDEX Registry index to yank from
--token TOKEN API token to use when authenticating
- -v, --verbose Use verbose output
+ -v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
}
pub fn show_warnings(&self, pkg: &PackageId) -> bool {
- pkg == self.resolve.root() || pkg.source_id().is_path()
+ pkg == self.resolve.root() || pkg.source_id().is_path() ||
+ self.config.extra_verbose()
}
}
rustc: PathBuf,
rustdoc: PathBuf,
target_dir: RefCell<Option<Filesystem>>,
+ extra_verbose: Cell<bool>,
}
impl Config {
rustc: PathBuf::from("rustc"),
rustdoc: PathBuf::from("rustdoc"),
target_dir: RefCell::new(None),
+ extra_verbose: Cell::new(false),
};
try!(cfg.scrape_tool_config());
}
pub fn configure_shell(&self,
- verbose: Option<bool>,
+ verbose: u32,
quiet: Option<bool>,
color: &Option<String>) -> CargoResult<()> {
+ let extra_verbose = verbose >= 2;
+ let verbose = if verbose == 0 {None} else {Some(true)};
let cfg_verbose = try!(self.get_bool("term.verbose")).map(|v| v.val);
let cfg_color = try!(self.get_string("term.color")).map(|v| v.val);
let color = color.as_ref().or(cfg_color.as_ref());
self.shell().set_verbosity(verbosity);
try!(self.shell().set_color_config(color.map(|s| &s[..])));
+ self.extra_verbose.set(extra_verbose);
Ok(())
}
+ pub fn extra_verbose(&self) -> bool {
+ self.extra_verbose.get()
+ }
+
fn load_values(&self) -> CargoResult<()> {
let mut cfg = CV::Table(HashMap::new(), PathBuf::from("."));
use std::fs::{self, File};
use std::io::prelude::*;
-<<<<<<< 07c1d9900de40c59b898d08d64273447560ffbe3:tests/build-script.rs
use cargotest::{rustc_host, is_nightly, sleep_ms};
use cargotest::support::{project, execs};
use cargotest::support::paths::CargoPathExt;
-=======
-use support::{project, execs};
-use support::paths::CargoPathExt;
-use support::registry::Package;
->>>>>>> Forward warnings from build scripts:tests/test_cargo_compile_custom_build.rs
+use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_file, existing_dir};
#[test]
execs().with_status(0)
.with_stderr(""));
}
+
+#[test]
+fn warnings_printed_on_vv() {
+ Package::new("bar", "0.1.0")
+ .file("build.rs", r#"
+ fn main() {
+ println!("cargo:warning=foo");
+ println!("cargo:warning=bar");
+ }
+ "#)
+ .file("Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.1.0"
+ authors = []
+ build = "build.rs"
+ "#)
+ .file("src/lib.rs", "")
+ .publish();
+
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.5.0"
+ authors = []
+
+ [dependencies]
+ bar = "*"
+ "#)
+ .file("src/lib.rs", "");
+
+ assert_that(p.cargo_process("build").arg("-vv"),
+ execs().with_status(0)
+ .with_stderr("\
+warning: foo
+warning: bar
+"));
+}
assert_that(p.cargo("build"),
execs().with_status(0));
}
+
+#[test]
+fn upstream_warnings_on_extra_verbose() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.5.0"
+ authors = []
+
+ [dependencies]
+ foo = "*"
+ "#)
+ .file("src/main.rs", "fn main() {}");
+ p.build();
+
+ Package::new("foo", "0.1.0")
+ .file("src/lib.rs", "fn unused() {}")
+ .publish();
+
+ assert_that(p.cargo("build").arg("-vv"),
+ execs().with_status(0).with_stderr_contains("\
+[..] warning: function is never used[..]
+"));
+}